#ifndef _LOGFILE_
#define _LOGFILE_

/*
 * LogFile class to implement log operations
 */

#include <fstream>

namespace Zen{namespace utility{

class LogFile
{
public:

	static const int MaxLogSize = 1024;

	LogFile(const char *fileName = NULL);
	~LogFile();

	bool open(const char *fileName = NULL);
	void close();
	void flush();
	bool isOpen() const;
	int size();

	const char * fileName() const;
	void setFileName(const char *fileName);

	int write(const char * buffer, int length);
	int log(const char *fmt, ...);

	static int LogEx(const char *fileName, const char *fmt, ...);

private:
	LogFile(const LogFile &);
    LogFile & operator= (const LogFile &);

private:
	std::fstream m_fileStream;
	const char *m_fileName;
};

}}

#endif // _LOGFILE_